﻿
@{
    ViewBag.Title = "Face";
}
@using Face.Model;
@model IList<Users_Model>
<h2>Face</h2>
<div class="row">
    <div class="col-md-4" style="padding-left:15px; padding-right:15px;">
        <div class="form-box" style="margin-bottom:15px;margin-left:15px;">
            <form class="form-inline">
                <div class="form-group" style="margin-right:15px;">
                    <input name="key" class="form-control" value="@ViewBag.key" placeholder="请输入姓名关键词" style="float:left; width:230px;">
                </div>
                <button class="btn btn-blue" type="submit" style="margin-left:5px;">查询</button>
            </form>
        </div>
        <ul>
            @foreach (var item in Model)
            {
                <li style="list-style:none;text-decoration:underline;padding-left:0px; padding-right:0px; ">
                    <div style="float:left; margin-left:-20px;">
                        <img src="/Upfiles/heads/@item.UserImg" class="icon-renzheng" style="width:80px; height:80px;" />
                    </div>

                    <div class="delte" style="float:left; margin-left:50px; margin-top:15px;margin-bottom:5px; ">
                        <h4 class="">@(item.UserName)</h4>
                        <p class="li_info">加入于 @(item.AddTime.Value.ToString("yyyy-MM-dd HH:mm"))</p>
                    </div>
                    <div style="float:left">
                        <a href="javascript:deleteUser(@item.Id.Value)">删除</a>
                    </div>
                    <div class="clear"></div>
                </li>
            }
        </ul>
        @if (ViewBag.totalCount > 15)
        {
            @Html.Pager((int)ViewBag.totalCount)
        }
    </div>
</div>


@section scripts{
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script src="~/Scripts/layer/layer.js"></script>
    <script type="text/javascript">
        function deleteUser(id) {
            layer.confirm('是否确认删除该用户?', function (index) {
                $.ajax({
                    type: "post",
                    url: "@Url.Action("DeleteUser")",
                    data: { userId: id },
                    success: function (data) {
                        if (data == "true") {
                            layer.msg("删除成功");
                            setTimeout(function () {
                                window.location.reload();
                            }, 300);
                        }
                        else {
                            layer.alert(data.msg);
                        }
                    },
                    error: function () { }
                });
                layer.close(index);
            });
        }
        $(function () {
            browserRedirect();
            function browserRedirect() {
                var sUserAgent = navigator.userAgent.toLowerCase();
                var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
                var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
                var bIsMidp = sUserAgent.match(/midp/i) == "midp";
                var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
                var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
                var bIsAndroid = sUserAgent.match(/android/i) == "android";
                var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
                var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
                var NokiaBrowser = sUserAgent.match(/NokiaBrowser/i) == "nokianrowser";
                var NOKIA = sUserAgent.match(/NOKIA/i) == "nokia";

                if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM || NokiaBrowser || NOKIA) {
                    $(".delte").css("margin-left", '30px');

                } else {
                    $(".delte").css("margin-left", '50px');
                }
            }
        })
    </script>
}
